package com.txunda.zhuohired.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.TextView;

import com.txunda.zhuohired.R;


/**
 * 创建人： Txd_Cjh
 * 创建时间： 2017/12/14 17:15
 * 功能描述：拨打电话Dialog
 * 联系方式：jiahuanchen@126.com
 */
public class ServicePhoneDialog extends Dialog implements View.OnClickListener {
    private CallPhoneListener callPhoneListener;
    private String tittle;
    private TextView tv_service_phone;

    public ServicePhoneDialog(@NonNull Context context, String tittle, @NonNull CallPhoneListener
            callPhoneListener) {
        super(context, R.style.dialog_style);
        this.callPhoneListener = callPhoneListener;
        this.tittle = tittle;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_service_dialog);
        findViewById(R.id.dialog_left_tv).setOnClickListener(this);
        findViewById(R.id.dialog_right_tv).setOnClickListener(this);
        tv_service_phone = findViewById(R.id.tv_service_phone);
        tv_service_phone.setText("客服电话  " + tittle);
    }

    @Override
    public void onClick(View view) {
        this.dismiss();
        if (view.getId() == R.id.dialog_right_tv) {
            callPhoneListener.onCallPhone();
        }
    }

    public interface CallPhoneListener {
        void onCallPhone();
    }

}
